18. Two Cars 1-5
Two Cars
The following questions deal with two cars that have pulled up to an intersection. It is equally likely than any individual car will turn left (L), go straight (S), or turn right (R).
In the notation we are using, P(S, L) means "probability that car one goes straight (S) and car two turns left (L)."
Question 1
For this question, assume the probabilities of left, straight, and right are all equal. That is:
P(L) = \frac{1}{3}
P(S) = \frac{1}{3}
P(R) = \frac{1}{3}
SOLUTION:
1/9Question 2
For this question assume that P(L) is known to be 1/2. The other two quantities are unknown
P(L) = \frac{1}{2}
P(S) = ?
P(R) = ?
SOLUTION:
Not enough information to be determined.Question 3
Now assume we know the following:
P(L) = 0.5
P(S) = 0.3
P(R) = ?
SOLUTION:
0.2Question 4
Match the mathematical calculation to the vehicle behavior.
Assume the following probabilities:
P(L) = 0.5
P(S) = 0.3
P(R) = 0.2
QUIZ QUESTION::
Match the mathematical calculation to the description of the two vehicles behavior.
ANSWER CHOICES:
Mathematical Description |
Description of Vehicles' Behavior |
---|---|
Both cars DON'T go right. |
|
First car goes right, second goes straight. |
|
First car goes left, second goes right |
|
Both cars go straight |
SOLUTION:
Mathematical Description |
Description of Vehicles' Behavior |
---|---|
Both cars DON'T go right. |
|
First car goes right, second goes straight. |
|
First car goes left, second goes right |
|
Both cars go straight |
Question 5
In the questions with two coin flips, each of which had two possible outcomes, you filled out a truth table with four rows (one each for "H,H", "H,T", "T,H" and "T,T").
Two flips. Two outcomes per flip. Four rows in the truth table.
SOLUTION:
9(Optional) Managing Complexity
Note: this section is optional and only here for those who are interested. You will not be expected to remember anything presented in any section labeled optional.
Roboticists will often use the term state space to describe the set of all possible outcomes for a probabilistic event.
For a coin the state space for a "flip" event can be written mathematically as:
{ \text{H}, \text{T} }
And for a car at an intersection the state space for a "turn" event can be written mathematically as:
{ \text{L}, \text{S}, \text{R} }
Coins and cars may seem differently, but we can treat them in similar ways when we think in terms of events and state spaces.
In the last question you saw that calculating a truth table for 2 coin flips requires 4 calculations while calculating the truth table for 2 car turns at an intersection requires 9 calculations.
We can make these statements more broadly applicable:
When calculating the truth table for 2 events which each have a state space size of 2, we need to make 4 calculations.
When calculating the truth table for 2 events which each have a state space size of 3, we need to make 9 calculations.
And in fact, there's a mathematical pattern here that can be expressed algebraically:
- When calculating the truth table for N events which each have a state space size of x, we need to make x^N calculations
x^N gets very big very fast as x or N get bigger.
You will see later this Nanodegree how this exponential complexity growth can really slow down the performance of the code running inside of a self driving car.